package com.demo.mybatis01.dao;

import com.demo.mybatis01.entity.Employee;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author liangliang
 */
public interface EmployeeMapper {

    Employee getEmpByIdAndLastName(@Param("id") Integer id, @Param("lastName") String lastName);

    Employee getEmpByMap(Map<String,Object> map);

    List<Employee> getEmpByLastNameLike(String like);

    @MapKey("id")
    // 指定对象中的属性作为key
    Map<String,Employee> getEmpMapByLastNameLike(String like);

    /**
     * 查询
     *
     * @param id
     * @return
     */
    Employee getEmpById(Integer id);

    Map getEmpMapById(Integer id);

    /**
     * 增加
     *
     * @param employee
     * @return
     */
    Boolean addEmp(Employee employee);

    /**
     * 删除
     *
     * @param id
     * @return
     */
    Boolean deleteEmpById(Integer id);

    /**
     * 修改
     *
     * @param employee
     * @return
     */
    Boolean updateEmp(Employee employee);
}
